<?php
session_start();

include_once "com/code/Controller.php";

function __autoload($className) {
	global $includePaths;
	if(!isset($includePaths)) {
		$includePaths = array();
		$includePaths['HomeController'] = "com/code/home/HomeController.php";
		$includePaths['EmisionPageController'] = "com/code/emisionpage/EmisionPageController.php";
		$includePaths['VideoSearchEngineController'] = "com/code/video/searchengine/VideoSearchEngineController.php";
		$includePaths['VideoMenuController'] = "com/code/video/menu/VideoMenuController.php";
		$includePaths['UploadController'] = "com/code/video/upload/UploadController.php";
		$includePaths['LoginController'] = "com/code/login/LoginController.php";
	}
	
	if(array_key_exists($className, $includePaths)) {
		require_once $includePaths[$className];
	}
}

$controllerName = $_REQUEST['controller'];
$controllerId = $_REQUEST['id'];
$method = $_REQUEST['do'];
$params = $_REQUEST['params'];

if (is_null($controllerName)) {
	$controllerName = "HomeController";
	$method = "getHomePage";
}

Controller::callMethod($controllerName, $controllerId, $method, $params);
?>